package com.lilicould.dao;

import com.lilicould.entity.Students;
import com.lilicould.entity.StudentsDetails;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface StudentDao {
    // 根据学工号查询学生信息
    @Select("select * from students where user_no = #{userNo}")
    Students getStudentByUserNo(String userNo);

    // 根据学工号查询学生详细信息
    @Select("select * from student_details_view where user_no = #{userNo}")
    StudentsDetails getStudentDetailsByUserNo(String userNo);

    // 查询所有学生信息
    @Select("select * from students")
    List<Students> getAllStudents();

    // 查询所有学生详细信息
    @Select("select * from student_details_view")
    List<StudentsDetails> getAllStudentsDetails();

    // 添加学生信息
    @Insert("insert into students values(#{userNo}, #{enrollmentYear}, #{collegeCode}, #{majorCode}, #{classCode})")
    int addStudent(Students student);

//    // 修改学生信息
//    void updateStudent(Students student);
//
    // 删除学生信息
    @Delete("delete from students where user_no = #{userNo}")
    int deleteStudent(String userNo);
}
